
#plot bailey data and SC data
bailey <- read.csv("bailey_data.csv", header = T)
year.bailey <- bailey$Year
bailey$sc.bailey <- bailey$SCMedian
attach.all(bailey)


pdf("figure3a.pdf", height = 3, width =8)

par(mar= c(2,5,1,1))
plot(year.bailey, sc.bailey, type = "n", xlim = c(1951,2002), ylim = c(-1.2,.5),
    axes = F, xlab = "", ylab ="", xaxs = "i")
#add shading for 1986-2002
#polygon(x=c(1986, 1986, 2002, 2002), y=par()$usr[c(3,4,4,3)],col="gray75", border=F)

#add shading for 1951-1985
polygon(x=c(1950, 1950, 1986, 1986), y=par()$usr[c(3,4,4,3)],col="gray75", border=F)

axis(1, at = seq(1950,2000,5), mgp = c(2,.5,0))
axis(2, at = c(-1,-.5,0,.5), las =1,mgp = c(2,.5,0))
box(bty="l")
points(year.bailey, sc.bailey, type = "l")
mtext("Ideology",2, line = 3.5, cex =1.5)
mtext("Conservative", 2, line =2, adj = 1)
mtext("Liberal",2, line =2, adj = 0)
text(1994, -.6, "Rehnquist Court")

dev.off()